const { createApp } = Vue

createApp({
    data() {
        return {
            user: {
                name: '张三',
                avatar: 'https://example.com/avatar.jpg',
                email: 'zhangsan@example.com'
            },
            statusFilter: 'all',
            appointments: [
                {
                    id: 1,
                    therapistName: '王医生',
                    therapistTitle: '资深心理咨询师',
                    therapistAvatar: 'https://example.com/therapist1.jpg',
                    date: '2024-01-20',
                    time: '14:00-15:00',
                    type: '面对面咨询',
                    location: '心理咨询室A',
                    status: 'pending',
                    statusText: '待进行'
                },
                {
                    id: 2,
                    therapistName: '李医生',
                    therapistTitle: '心理治疗师',
                    therapistAvatar: 'https://example.com/therapist2.jpg',
                    date: '2024-01-18',
                    time: '10:00-11:00',
                    type: '在线咨询',
                    location: '线上会议室',
                    status: 'completed',
                    statusText: '已完成'
                }
            ]
        }
    },
    computed: {
        filteredAppointments() {
            if (this.statusFilter === 'all') {
                return this.appointments
            }
            return this.appointments.filter(appointment =>
                appointment.status === this.statusFilter
            )
        }
    },
    methods: {
        goToPage(page) {
            switch (page) {
                case 'index':
                    window.location.href = 'index.html';
                    break;
                case 'consultation':
                    window.location.href = 'consultation.html';
                    break;
                case 'therapist':
                    window.location.href = 'therapist.html';
                    break;
                case 'about':
                    window.location.href = 'about.html';
                    break;
                case 'user-center':
                    window.location.href = 'user-center.html';
                    break;
            }
        },
        cancelAppointment(appointment) {
            if (confirm(`确定要取消与${appointment.therapistName}的预约吗？`)) {
                appointment.status = 'cancelled';
                appointment.statusText = '已取消';
                alert('预约已取消');
            }
        },
        rescheduleAppointment(appointment) {
            // 实现改期功能
            console.log('改期预约：', appointment);
            alert('改期功能开发中');
        }
    }
}).mount('#app') 